<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<title>博客内容列表 </title>
	<meta name="robots" content="noindex, nofollow">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link href="${pageContext.request.contextPath}/Styles/general.css" rel="stylesheet" type="text/css" />
	<link href="${pageContext.request.contextPath}/Styles/main.css" rel="stylesheet" type="text/css" />
	
	
	<link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/Js/bootstrap/css/bootstrap.min.css" />
	
	<script src="${pageContext.request.contextPath}/Js/jquery.min.js"></script>
  	<script src="${pageContext.request.contextPath}/Js/bootstrap/js/bootstrap.min.js"></script>
  	
</head>
<body>
<h1>
    <span class="action-span"><a href="${pageContext.request.contextPath}/blog/input">新增博客</a></span>
    <span class="action-span1"><a href="__GROUP__">博客 管理中心</a></span>
    <span id="search_id" class="action-span1"> - 博客信息列表 </span>
    <div style="clear:both"></div>
</h1>
<!--  搜索框:开始 -->
<div class="form-div">
    <form action="${pageContext.request.contextPath}/customer_list" name="searchForm" method="post">
      标题：<input type="text" name="title"/>
        <!-- 关键字 -->
        <input type="submit" value=" 搜索 " class="button" />
    </form>
</div>
<!--  搜索框 :结束-->

<form method="post" action="" name="listForm">
    <div class="list-div" id="listDiv">
        <table width="100%" cellspacing="1" cellpadding="2" id="list-table">
            <tr>
                <th>序号</th>
                <th>标题</th>
                <th>作者</th>
                <th>所属分类</th>
                <th>创建时间</th>
                <th>修改时间</th>
                <th>操作</th>
            </tr>
            <c:forEach items="${pageInfo.list}" var="blog">
              <tr align="center" class="0">
            	<td align="left" class="first-cell" >
            		${blog.id}
                </td>
                <td align="left" class="first-cell" >
                	${blog.title}
                </td>
                <td align="left" class="first-cell" >
                	${blog.author}
                </td>
                
                <td align="left" class="first-cell" >
                	${blog.categoryName}
                </td>
                 <td align="left" class="first-cell" >
                 	<fmt:formatDate value="${blog.created}" pattern="yyyy-MM-dd HH:mm:ss"/>
                </td>
                <td align="left" class="first-cell" >
                    <fmt:formatDate value="${blog.updated}" pattern="yyyy-MM-dd HH:mm:ss" />
                </td>
                <td width="30%" align="center">
                <a href="${pageContext.request.contextPath}/blog/findById?id=${blog.id}">编辑</a> |
                <a href="javascript:void()" title="移除" onclick="del('${blog.id}')">移除</a>
                </td>
              </tr>
            </c:forEach>
        </table>
        
        
        <!--文字信息-->
        <div class="col-md-6 infos">
               	当前第 ${pageInfo.pageNum} 页.总共 ${pageInfo.pages} 页.一共 ${pageInfo.total} 条记录
        </div>
        
        
        <!--点击分页-->
        <div class="col-md-6">
            <nav aria-label="Page navigation">
                <ul class="pagination">
                    
                    <li><a href="${pageContext.request.contextPath}/blog/list?pageNum=1">首页</a></li>
                    
                    <!--上一页-->
                    <li>
                        <c:if test="${pageInfo.hasPreviousPage}">
                            <a href="${pageContext.request.contextPath}/blog/list?pageNum=${pageInfo.pageNum-1}" aria-label="Previous">
                                <span aria-hidden="true">«</span>
                            </a>
                        </c:if>
                    </li>
 
                    <!--循环遍历连续显示的页面，若是当前页就高亮显示，并且没有链接-->
                    <c:forEach items="${pageInfo.navigatepageNums}" var="page_num">
                        <c:if test="${page_num == pageInfo.pageNum}">
                            <li class="active"><a href="#">${page_num}</a></li>
                        </c:if>
                        <c:if test="${page_num != pageInfo.pageNum}">
                            <li><a href="${pageContext.request.contextPath}/blog/list?pageNum=${page_num}">${page_num}</a></li>
                        </c:if>
                    </c:forEach>
 
                    <!--下一页-->
                    <li>
                        <c:if test="${pageInfo.hasNextPage}">
                            <a href="${pageContext.request.contextPath}/blog/list?pageNum=${pageInfo.pageNum+1}"
                               aria-label="Next">
                                <span aria-hidden="true">»</span>
                            </a>
                        </c:if>
                    </li>
                    
                    <li><a href="${pageContext.request.contextPath}/blog/list?pageNum=${pageInfo.pages}">尾页</a></li>
                </ul>
            </nav>
        </div>
 
   
   </div>
</form>
<div id="footer">
共执行 1 个查询，用时 0.055904 秒，Gzip 已禁用，内存占用 2.202 MB<br />
版权所有 &copy; lmyau</div>

<script type="text/javascript">
	function del(id){
		if(window.confirm("确认删除此记录吗?一但删除不能恢复了")){
			window.location.href="${pageContext.request.contextPath}/blog/delete?id="+id;
		}
	}
</script>

</body>


<style>
	.infos{
		
		height:50px;
		margin-top:20px;
	}
</style>
</html>
